<?php
    
    
    namespace addons\zpwxsys\controller\v1;
    
    
    use addons\zpwxsys\controller\BaseController;
    use addons\zpwxsys\model\Baoming as BaomingModel;
    use addons\zpwxsys\service\Token;
    
    /*
     * 求职者报名接口
     */
    
    class Baoming extends BaseController
    {
        
        
        /*
         * 保存报名信息
         */
        
        
        public function saveBaoming()
        {
            if (request()->isPost()) {
                
                $param = input('post.');
                
                $param['uid'] = Token::getCurrentUid();
                
                
                $map['uid'] = $param['uid'];
                
                $map['jobid'] = $param['jobid'];
                
                
                $agentinfo = BaomingModel::getAgentByuid($map);
                
                $baoming = new BaomingModel();
                
                if (!$agentinfo) {
                    
                    
                    $data = $baoming->insertBaoming($param);
                    
                } else {
                    
                    $data = json_encode(array('status' => 1, 'msg' => '您的信息已提交过'));
                    
                }
                
                return $data;
            }
            
            
        }
        
        
    }